package dongshi.daddy.observer.v2;

import dongshi.daddy.observer.v2.observer.LiDaMaObserver;
import dongshi.daddy.observer.v2.observer.WangDaYeObserver;
import dongshi.daddy.observer.v2.subject.SuperMarketSubject;
import dongshi.daddy.observer.v2.subject.WuMeiSubject;

public class V2TEST {
    public static void main(String[] args) {
        // 创建主题类
        SuperMarketSubject subject = new WuMeiSubject();
        // 创建李大妈观察者类
        LiDaMaObserver liDaMaObserver = new LiDaMaObserver();
        // 创建王大爷观察者类
        WangDaYeObserver wangDaYeObserver = new WangDaYeObserver();
        // 将李大妈和王大爷添加到物美主体类中，等待接受来自物美超市的优惠活动
        subject.addOldPeopleObserver(liDaMaObserver);
        subject.addOldPeopleObserver(wangDaYeObserver);

        System.out.println("----------西瓜搞活动----------");
        subject.notify("西瓜");

        System.out.println("----------香菜搞活动----------");
        subject.notify("香菜");
    }
}

